function get(uri, callback, errCallback) {
	var xhr = getXMLHttpRequest();
	if (xhr) {
		xhr.onreadystatechange = function() {
			if (xhr.readyState == 4) {
				if (xhr.status == 200 || xhr.status == 0) {
					callback(xhr.responseText);
				} else if (errCallback) {
					errCallback(xhr);
				}
			}
		};
		xhr.open("GET", uri, true);
		xhr.send(null);
	} else if (errCallback) {
		errCallback(xhr);
	}
}

function getXMLHttpRequest() {
	var request = false;
	try {
		request = new ActiveXObject('Msxml2.XMLHTTP');
	} catch (err2) {
		try {
			request = new ActiveXObject('Microsoft.XMLHTTP');
		} catch (err3) {
			try {
				request = new XMLHttpRequest();
			} catch (err1) {
				request = false;
			}
		}
	}
	return request;
}



function getJson(uri, callback, errCallback) {
	var xhr = JSONRequest.get(uri, function(xhr, value, exception) {
		if (value) {
			callback(value);
		} else {
			errCallback(exception);
		}
	});
}

function postJson(uri, params, callback, errCallback) {
	var xhr = JSONRequest.post(uri, params, function(xhr, value, exception) {
		if (value) {
			callback(value);
		} else {
			errCallback(exception);
		}
	});
}


function cancelJson(request) {
	JSONRequest.cancel(request);
}

